let app = getApp();
import {
  imageUrl
} from "../../utils/imageutil"
import {
  is_auth
} from "../../utils/util"
import {
  rpxToPx
} from "../../utils/util"
Component({
  properties: {
    selected: {
      type: Number,
      value: 0
    },
    num: {
      type: Number,
      value: 0
    },
  },
  data: {
    imageUrl,
    tabH: 0,
    applettab_info: getApp().globalData.applettab_info,
    isIphoneX: false,
    "color": "#666666",
    "selectedColor": "#ee6e01",
    "backgroundColor": "#ffffff",
    "list": [
       {
        "pagePath": "/pages/index/index",
        "text": "首页",
        "id": 1,
        "iconPath": imageUrl+"/tabbarIcon/Slice782h.png",
        "selectedIconPath": imageUrl+"/tabbarIcon/Slice782s.png"
      },
      {
        "pagePath": "/pages/union/new_union",
        "text": "速配",
        "id": 2,
        "iconPath": imageUrl+"/index/Slice1424.png",
        "selectedIconPath": imageUrl+"/index/Slice1424s.png"
      },
      {
        "pagePath": "/pages/news/news?nav_curr=1",
        "text": "消息",
        "id": 3,
        "iconPath": imageUrl+"/index/Slice1425.png",
        "selectedIconPath": imageUrl+"/index/Slice1425s.png"
      },
      
    
      {
        "pagePath": "/pages/my/my",
        "text": "我的",
        "id": 4,
        "iconPath": imageUrl+"/tabbarIcon/Slice784h.png",
        "selectedIconPath": imageUrl+"/tabbarIcon/Slice784s.png"
      }
    ]
  },
  lifetimes: {
    ready: function () {
      this.setData({
        num: getApp().globalData.unreadCount,
        isIphoneX: getApp().globalData.isIphoneX,
        applettab_info: getApp().globalData.applettab_info,
      })
      let isIphoneX = getApp().globalData.isIphoneX;
      if (isIphoneX) {
        this.setData({
          tabH: rpxToPx(96 + 68)
        })
      } else {
        this.setData({
          tabH: rpxToPx(96)
        })
      }
    },
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
        console.log(e,'xxxd');
        wx.navigateTo({
          url:url
          // +'?heqiong=1'
        })
      
    },
  }
})